const service = require("../service/coService");
const controller = {
    // 插入合作表数据
    postCooperate(req, res) {
        service.postCooperate(req.body, (data) => {
            res.send({ status: data?.affectedRows ? 200 : 400, msg: data ? data.affectedRows ? "插入成功" : "插入错误" : "插入错误" })
        })
    },
    // 删除接口
    deleteCooperate(req, res) {
        const { cid } = req.params
        service.deleteCooperate(cid, (data) => {
            res.send({
                status: data?.affectedRows ? 200 : 400,
                msg: data ? data.affectedRows ? "删除成功" : "删除失败" : "删除失败"
            })
        })
    },
}

module.exports = controller